<%@ page import="com.wuming.house.security.SecurityHander" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/share/taglib.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <title>二手房信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${allServerPath}static/layui/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body style="background-color: #f0f2f5;">
<div style="padding: 15px;margin: 15px;background-color: #fff;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>二手房基本信息</legend>
    </fieldset>
    <form class="layui-form" id="houseFrom">
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">房产描述</label>

                    <div class="layui-input-inline">
                        <input name="houseDesc" class="layui-input" type="text" autocomplete="off" placeholder="请输入房产描述"
                               value="${house.houseDesc}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">楼盘名称</label>

                    <div class="layui-input-inline">
                        <input name="houseName" class="layui-input" type="text" autocomplete="off" placeholder="请输入楼盘名称"
                               value="${house.houseName}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">总价</label>

                    <div class="layui-input-inline">
                        <input name="totalPrice" class="layui-input" type="text" autocomplete="off"
                               placeholder="请输入总价"
                               value="${house.totalPrice}">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">户型</label>

                    <div class="layui-input-inline">
                        <select id="houseLayout" name="houseLayout" lay-filter="templet">
                            <option value=""></option>
                            <option value="一居">一居</option>
                            <option value="二居">二居</option>
                            <option value="三居">三居</option>
                            <option value="四居">四居</option>
                            <option value="五居">五居</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">区域</label>

                    <div class="layui-input-inline">
                        <input name="area" class="layui-input" type="tel" autocomplete="off" placeholder="请输入区域"
                               value="${house.area}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">楼型</label>

                    <div class="layui-input-inline">
                        <input name="storeType" class="layui-input" type="tel" autocomplete="off" placeholder="请输入楼型"
                               value="${house.storeType}">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">装修</label>

                    <div class="layui-input-inline">
                        <input name="decoration" class="layui-input" type="tel" autocomplete="off" placeholder="请输入装修类型"
                               value="${house.decoration}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">看房方式</label>

                    <div class="layui-input-inline">
                        <input name="lookMethod" class="layui-input" type="tel" autocomplete="off" placeholder="请输入看房方式"
                               value="${house.lookMethod}">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">楼层</label>

                    <div class="layui-input-inline">
                        <input name="storey" class="layui-input" type="tel" autocomplete="off" placeholder="请输入楼层"
                               value="${house.storey}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">年代</label>

                    <div class="layui-input-inline">
                        <input name="age" class="layui-input" type="tel" autocomplete="off" placeholder="请输入年代"
                               value="${house.age}">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">朝向</label>

                    <div class="layui-input-inline">
                        <input name="orientations" class="layui-input" type="tel" autocomplete="off" placeholder="请输入朝向"
                               value="${house.orientations}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">单价</label>

                    <div class="layui-input-inline">
                        <input name="unitPrice" class="layui-input" type="tel" autocomplete="off" placeholder="请输入单价"
                               value="${house.unitPrice}">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">房屋面积</label>

                    <div class="layui-input-inline">
                        <input name="houseArea" class="layui-input" type="tel" autocomplete="off" placeholder="请输入房屋面积"
                               value="${house.houseArea}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">楼盘地址</label>

                    <div class="layui-input-inline">
                        <input name="houseAddr" class="layui-input" type="tel" autocomplete="off" placeholder="请输入楼盘地址"
                               value="${house.houseAddr}">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">联系电话</label>

                    <div class="layui-input-inline">
                        <input name="contactPhone" class="layui-input" type="tel" autocomplete="off" placeholder="请输入联系电话"
                               value="${house.contactPhone}">
                    </div>
                </div>

            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">核心卖点</label>
                    <div class="layui-input-inline">
                        <textarea name="coreSellPoint" required lay-verify="required" placeholder="请输入核心卖点" class="layui-textarea">${house.coreSellPoint}</textarea>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">业主心态</label>

                    <div class="layui-input-inline">
                        <textarea name="ownerMentality" required lay-verify="required" placeholder="请输入业主心态" class="layui-textarea">${house.ownerMentality}</textarea>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">小区配套</label>

                    <div class="layui-input-inline">
                        <textarea name="communityMatching" required lay-verify="required" placeholder="请输入小区配套" class="layui-textarea">${house.communityMatching}</textarea>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-row" style="text-align: center;">
            <button class="layui-btn layui-btn-normal" type="button" name="btnSave" id="saveHouse">保存</button>
        </div>
        <input type="hidden" name="id" value="${house.id}">
        <input type="hidden" name="memberId" value="${memberId}"/>
    </form>
</div>


<script src="${allServerPath}static/layui/layui/layui.js"></script>
<script>
    layui.use(['form', 'jquery'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery;

        var houseLayout = '${house.houseLayout}';
        $("#houseLayout").val(houseLayout);
        form.render();

        $("#saveHouse").click(function () {
            $.ajax({
                type: "post",
                url: "${allServerPath}/web/secondhouse/save.htmls",
                data: $('#houseFrom').serialize(),// 你的formid
                dataType: "JSON",
                success: function (data) {
                    if (data.success) {
                        layer.msg("保存成功.");
                    } else {
                        layer.msg("保存失败,请稍后重试.");
                    }
                },
                error: function (msg) {
                    layer.msg("保存失败.");
                }
            });
        });
    });
</script>
</body>
</html>
